﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        //if (AsyncFileUpload1.HasFile)
        //{
        //    string[] filename = AsyncFileUpload1.FileName.Split('.');
        //    string duoifile = filename[1];
        //    if (duoifile=="rar"||duoifile=="zip")
        //    {
        //        string duongdan = Server.MapPath("documents/" + AsyncFileUpload1.FileName);
        //        AsyncFileUpload1.SaveAs(duongdan);
        //    }
        //    else
        //    {
        //        Label1.Text = "Chỉ dc phép up load file .rar hoac .zip";
        //    }
        //}
        if (FileUpload1.HasFile)
        {
            string[] filename = FileUpload1.FileName.Split('.');
            string duoifile = filename[1];
            if (duoifile == "rar" || duoifile == "zip")
            {
                string duongdan = Server.MapPath("documents/" + FileUpload1.FileName);
                FileUpload1.SaveAs(duongdan);
            }
        }
    }
}
